﻿@{
	Layout = null;

	bool siteExists = SiteData.CurretSiteExists;
}

<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="en">
<!--<![endif]-->
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
	<link href="~/Assets/Admin/includes/normalize.css" rel="stylesheet" type="text/css" />
	<title>
		@String.Format("{0} - {1}", SiteData.CarrotCakeCMSVersionMM, ViewBag.Title)
	</title>

	@(new jquerybasic() { SelectedSkin = jquerybasic.jQueryTheme.LightGreen, UseJqueryMigrate = true })

	<link href="~/Assets/iCheck/iCheck.css" rel="stylesheet" />
	<link href="~/Assets/Admin/Includes/fauxstrap.css" rel="stylesheet" />
	<link href="~/Assets/Admin/Includes/chosen.min.css" rel="stylesheet" />
	<link href="~/Assets/Admin/includes/jquery.ui.timepicker.css" rel="stylesheet" type="text/css" />
	<link href="~/Assets/Admin/includes/modal.css" rel="stylesheet" type="text/css" />
	<link href="~/Assets/Admin/includes/main.css" rel="stylesheet" type="text/css" />
	<link href="~/Assets/Admin/includes/common.css" rel="stylesheet" type="text/css" />
	<link href="~/Assets/Admin/includes/TableStyles.css" rel="stylesheet" type="text/css" />

	<script src="~/Assets/iCheck/icheck.min.js"></script>
	<script src="~/Assets/Admin/Includes/icheck.init.js"></script>
	<script src="~/Assets/Admin/includes/jquery.ui.timepicker.js" type="text/javascript"></script>
	<script src="~/Assets/Admin/includes/base64.js" type="text/javascript"></script>
	<script src="~/Assets/Admin/includes/jquery.simplemodal.js" type="text/javascript"></script>
	<script src="~/Assets/Admin/includes/jquery.blockUI.js" type="text/javascript"></script>
	<script src="~/Assets/Admin/Includes/chosen.jquery.min.js"></script>
	<script src="~/Assets/Admin/includes/common-utils.js" type="text/javascript"></script>

	<script type="text/javascript">

		$(document).ready(function () {
			AjaxBtnLoad();
		});

		$(document).ajaxComplete(function (event, xhr, settings) {
			AjaxBtnLoad();
		});
	</script>

	<!-- TinyMCE -->
	<script type="text/javascript" src="~/Assets/tiny_mce/tiny_mce.js"></script>
	<script type="text/javascript" src="~/Assets/Admin/includes/tinymce-config.js"></script>
	<script type="text/javascript">
		var bTinyLoaded = false;
		function AjaxTinyLoad() {
			if (!bTinyLoaded) {
				TinyMCEParamInit("700", "500", false);
			}
			bTinyLoaded = true;
		}

		$(document).ready(function () {
			AjaxTinyLoad();
		});

		$(document).ajaxComplete(function (event, xhr, settings) {
			AjaxTinyLoad();
		});
	</script>
	<!-- /TinyMCE -->
	@RenderSection("scripts", required: false)
</head>
<body>

	<div id="cmsAjaxMainDiv">
		<div id="headercontainer">
			<div id="header">
				<h2>
					@SiteData.CarrotCakeCMSVersionMM
				</h2>
				<div style="clear: both">
				</div>
				<h3>
					@if (SiteData.CurrentSite != null) {
						if (!String.IsNullOrEmpty(SiteData.CurrentSite.SiteTagline)
									&& !String.IsNullOrEmpty(SiteData.CurrentSite.SiteTagline)) {
							@String.Format("{0}:  {1}", SiteData.CurrentSite.SiteName, SiteData.CurrentSite.SiteTagline)
						} else {
							@String.Format("{0}  {1}", SiteData.CurrentSite.SiteName, SiteData.CurrentSite.SiteTagline)
						}
					} else {
						<span>&nbsp;</span>
					}
				</h3>

				<div class="widthshim">
				</div>
			</div>
		</div>

		<div id="nav-menu-container">
			<ul id="nav-menu">
				<li id="tabHome">
					<a href="@SiteData.AdminFolderPath">
						<img alt="Home" src="~/Assets/Admin/Images/house.png" />
					</a>
				</li>

				@using (CarrotWeb.BeginWrappedItem("li", "Index;SiteInfo;ContentEditHistory;SiteSkinIndex;SiteSkinEdit;SiteTemplateUpdate;SiteDataExport;ContentImport;SiteContentStatusChange;SiteSkinIndex", RouteConfig.AdminCtrlr, new { @id = "tabMainTop", @class = "current sub" }, new { @id = "tabMainTop", @class = "sub" })) {
					<a href="javascript:void(0)" class="lnkPopup">Site </a>
					<ul class="children">
						<li id="tabMain"><a href="@SiteFilename.SiteInfoURL">Site Info</a> </li>
						@if (siteExists) {
							<li id="tabHistory"><a href="@SiteFilename.ContentEditHistoryURL">Content Edit History</a> </li>
							<li id="tabContentSkin"><a href="@SiteFilename.SiteSkinIndexURL">Site Skin Index</a> </li>
							<li id="tabMainTemplate"><a href="@SiteFilename.SiteTemplateUpdateURL">Bulk Apply Templates</a> </li>
							<li id="tabStatusChange"><a href="@SiteFilename.SiteContentStatusChangeURL">Bulk Change Status</a> </li>
							<li id="tabExportSite"><a href="@SiteFilename.SiteExportURL">Export Site</a> </li>
							<li id="tabImportContent"><a href="@SiteFilename.ContentImportURL">Import Content</a> </li>
						}
					</ul>
				}

				@if (siteExists) {
					using (CarrotWeb.BeginWrappedItem("li", "PageIndex;PageAddEdit;PageTemplateUpdate;SiteMap;PageCommentIndex", RouteConfig.AdminCtrlr, new { @id = "tabContentTop", @class = "current sub" }, new { @id = "tabContentTop", @class = "sub" })) {
						<a href="javascript:void(0)" class="lnkPopup">Pages </a>
						<ul class="children">
							<li id="tabContent"><a href="@SiteFilename.PageIndexURL">Page Index</a> </li>
							<li id="tabAddContent"><a href="@SiteFilename.PageAddEditURL">Add Page</a> </li>
							<li id="tabContentTemplate"><a href="@SiteFilename.PageTemplateUpdateURL">Bulk Apply Templates</a> </li>
							<li id="tabContentSiteMap"><a href="@SiteFilename.SiteMapURL">Edit Site Map</a> </li>
							<li id="tabContentCommentIndex"><a href="@SiteFilename.PageCommentIndexURL">Page Comment Index</a> </li>
						</ul>
					}

					using (CarrotWeb.BeginWrappedItem("li", "BlogPostIndex;BlogPostAddEdit;BlogPostTemplateUpdate;CategoryIndex;CategoryAddEdit;TagIndex;TagAddEdit;BlogPostCommentIndex", RouteConfig.AdminCtrlr, new { @id = "tabBlogTop", @class = "current sub" }, new { @id = "tabBlogTop", @class = "sub" })) {
						<a href="javascript:void(0)" class="lnkPopup">Posts </a>
						<ul class="children">
							<li id="tabBlogContent"><a href="@SiteFilename.BlogPostIndexURL">Blog Post Index</a> </li>
							<li id="tabAddBlogContent"><a href="@SiteFilename.BlogPostAddEditURL">Add Blog Post</a> </li>
							<li id="tabBlogTemplate"><a href="@SiteFilename.BlogPostTemplateUpdateURL">Bulk Apply Templates</a> </li>
							<li id="tabBlogCategoryIndex"><a href="@SiteFilename.CategoryIndexURL">Blog Category Index</a> </li>
							<li id="tabBlogTagIndex"><a href="@SiteFilename.TagIndexURL">Blog Tag Index</a> </li>
							<li id="tabBlogCommentIndex"><a href="@SiteFilename.BlogPostCommentIndexURL">Blog Comment Index</a> </li>
						</ul>
					}

					using (CarrotWeb.BeginWrappedItem("li", "ModuleIndex;TextWidgetIndex;ContentSnippetIndex", RouteConfig.AdminCtrlr, new { @id = "tabExtensions", @class = "current sub" }, new { @id = "tabExtensions", @class = "sub" })) {
						<a href="javascript:void(0)" class="lnkPopup">Extensions </a>
						<ul class="children">
							<li id="tabModules"><a href="@SiteFilename.ModuleIndexURL">Modules</a> </li>
							<li id="tabTxtWidgets"><a href="@SiteFilename.TextWidgetIndexURL">Text Widgets</a> </li>
							<li id="tabSnippets"><a href="@SiteFilename.ContentSnippetIndexURL">Content Snippets</a> </li>
						</ul>
						@*@Html.ActionLink("Module Index", "ModuleIndex", RouteConfig.AdminCtrlr, new { area = "", @id = "" }, null)*@
					}
				}

				<li><a href="javascript:void(0)" class="lnkPopup" onclick="cmsFileBrowserOpen('not-a-real-file')">Browse Files</a> </li>

				@if (SecurityData.IsAdmin) {
					using (CarrotWeb.BeginWrappedItem("li", "UserIndex;RoleIndex;RoleAddEdit;UserAdd;UserEdit", RouteConfig.AdminCtrlr, new { @id = "tabUserSecurity", @class = "current sub" }, new { @id = "tabUserSecurity", @class = "sub" })) {
						<a href="javascript:void(0)" class="lnkPopup">Security </a>
						<ul class="children">
							<li id="tabUserAdmin"><a href="@SiteFilename.UserIndexURL">Users</a> </li>
							<li id="tabGroupAdmin"><a href="@SiteFilename.RoleIndexURL">Roles</a> </li>
							<li id="tabSites"><a href="@SiteFilename.SiteIndexURL">Sites</a> </li>
						</ul>
					}
				}

				<li><a href="javascript:void(0)" class="lnkPopup" onclick="ShowWindowNoRefresh('@SiteFilename.AboutURL')">About</a></li>

				<li><a class="lnkPopup" target="_blank" href="~/">View Site</a> </li>

				<li id="tabProfileTop" class="sub">
					<a href="javascript:void(0)" class="lnkPopup">
						@String.Format("My Profile [{0}]", SecurityData.CurrentUserIdentityName)
					</a>
					<ul class="children">
						<li><a href="javascript:void(0)" class="lnkPopup" onclick="ShowWindowNoRefresh('@SiteFilename.UserProfileURL');">Edit Profile</a> </li>
						<li><a href="javascript:void(0)" class="lnkPopup" onclick="ShowWindowNoRefresh('@SiteFilename.ChangePasswordURL');">Change Password</a> </li>
						<li><a href="javascript:void(0)" class="lnkPopup" onclick="LogoutLink();">Logout</a> </li>
					</ul>
				</li>
				<li>&nbsp;</li>
			</ul>
		</div>
		<div class="widthshim">
		</div>

		<div id="content">
			<div class="pad-content">
				<h1 class="headingColor">
					@ViewBag.Title
				</h1>

				<div id="cmsAjaxMainDiv">
					<div id="ajaxUpdatePanel">

						@RenderBody()
					</div>
				</div>
			</div>
		</div>

		<div style="display: none">
			<input type="hidden" id="hdnShowSaveLayer" value="@ViewBag.SavedPageAlert" />

			<div id="cms-basic-modal-content">
				<div id="cmsModalFrame">
				</div>
			</div>

			<div style="display: none;">
				<img src="~/Assets/Admin/images/ui-anim_basic_16x16.gif" alt="anim_basic_16x16" />
				<img src="~/Assets/Admin/images/x.png" alt="x" />
				<img src="~/Assets/Admin/images/mini-spinner3-6F997D.gif" alt="spinner" />
				<img src="~/Assets/Admin/images/Ring-64px-A7B2A0.gif" alt="ring" />
				<img src="~/Assets/Admin/images/ani-smallbar.gif" alt="bar" />
			</div>

			<div id="divCMSModal" title="CarrotCake CMS">
				<div id="divCMSModalMsg">
					&nbsp;
				</div>
			</div>

			<div id="divCMSCancelWin" title="Quit Editor?">
				<p id="divCMSCancelWinMsg">
					Are you sure you want cancel?
				</p>
			</div>
		</div>

		<script type="text/javascript">

			function LogoutLink() {
				var opts = {
					"No": function () { cmsAlertModalClose(); },
					"Yes": function () { ClickLogout(); }
				};

				cmsAlertModalSmallBtns('Are you sure you want to logout?.', opts);

				return false;
			}

			function ClickLogout() {
				$('#btnLogout').click();
			}
		</script>

		<div style="display: none;">

			<form action="#" method="post">
				<input type="submit" />
			</form>

			@if (Request.IsAuthenticated) {
				using (Html.BeginForm("LogOff", RouteConfig.AdminCtrlr, new { area = "" }, FormMethod.Post, new { id = "logoutForm" })) {
					@Html.AntiForgeryToken()

					<input type="submit" name="btnLogout" value="Logout" id="btnLogout" />
				}
			}
		</div>

		<div id="footer">
			<div id="footer-inner">
				<p>
					&copy; <a target="_blank" href="http://www.carrotware.com">carrotware.com</a>
					@String.Format(" 2001 - {0:yyyy} ", DateTime.UtcNow)
					<br />
					@SiteData.CarrotCakeCMSVersion
					<br />
					@if (SiteData.CurrentSite != null) {
						<span>
							Site Time: @SiteData.CurrentSite.Now
							@SiteData.CurrentSite.TimeZoneIdentifier
						</span>
						<br />
					}
				</p>
			</div>
			<div class="widthshim">
			</div>
		</div>
	</div>
	@RenderSection("footer", required: false)

	<div>
		@{
			string partialView = Helper.InsertSpecialView(Helper.ViewLocation.AdminMainFooter);
			if (!String.IsNullOrEmpty(partialView)) {
				@Html.Partial(partialView)
			}
		}
	</div>
</body>
</html>